package net.hn.hnms.biz.plan.service.impl;

import net.hn.hnms.biz.plan.mapper.CustomFieldsMapper;
import net.hn.hnms.biz.plan.service.CustomFieldsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.LinkedHashMap;
import java.util.Map;
import java.util.stream.Collectors;

@Service
public class CustomFieldsServiceImpl implements CustomFieldsService {

    @Autowired
    private CustomFieldsMapper customFieldsMapper;

    @Override
    public Map<String, String> getAll() {
        return customFieldsMapper.getAll().entrySet().stream()
                .sorted(Map.Entry.comparingByKey())
                .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (e1, e2) -> e1, LinkedHashMap::new));
    }
}
